// store.js
import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export const store = new Vuex.Store({
  state: {
    currentLanguage: 'zh', // 默认语言
  },
  mutations: {
    changeLanguage(state, language) {
      state.currentLanguage = language;
      Vue.prototype.$global.language = language; // 更新全局语言设置
    },
  },
  getters: {
    currentLanguage: state => state.currentLanguage,
  },
});
